//
//  ROMainTabBarViewController.swift
//  yuejian
//
//  Created by gyy on 2017/9/25.
//  Copyright © 2017年 gyy. All rights reserved.
//

import UIKit

class ROMainTabBarViewController: RDVTabBarController {
    
    override func viewDidLoad() {
        
        super.viewDidLoad()
        
        setupTabBarController()
        // Do any additional setup after loading the view.
    }
    
    func setupTabBarController(){
        //        let firstViewController = UIViewController()
        //        firstViewController.title = "店铺"
        //        firstViewController.view.backgroundColor = UIColor.red
        //        let firstNavigationController = UINavigationController(rootViewController: firstViewController)
        
      
        
        //        let secondViewController = UIViewController()
        //        secondViewController.title = "收藏"
        //        secondViewController.view.backgroundColor = UIColor.blue
        //        let secondNavigationController = UINavigationController(rootViewController: secondViewController)
        
        let DaShiStoryboard: UIStoryboard = UIStoryboard(name: "DaShi", bundle: nil)
        let DaShiNaigationController : UIViewController = DaShiStoryboard.instantiateViewController(withIdentifier: "DaShi")
        
        
        
        let XunLianStoryboard: UIStoryboard = UIStoryboard(name: "XunLian", bundle: nil)
        let XunLianNaigationController : UIViewController = XunLianStoryboard.instantiateViewController(withIdentifier: "XunLian")
        
        //        let thirdViewController = UIViewController()
        //        thirdViewController.title = "我"
        //        thirdViewController.view.backgroundColor = UIColor.yellow
        //        let thirdNavigationController = UINavigationController(rootViewController: thirdViewController)
        let ClubStoryboard: UIStoryboard = UIStoryboard(name: "Club", bundle: nil)
        let ClubPageNaigationController : UIViewController = ClubStoryboard.instantiateViewController(withIdentifier: "ClubNav")
        //
        let myselfStoryboard: UIStoryboard = UIStoryboard(name: "myself", bundle: nil)
        let myselfNaigationController : UIViewController = myselfStoryboard.instantiateViewController(withIdentifier: "me")
        
        self.viewControllers = [ DaShiNaigationController,XunLianNaigationController,ClubPageNaigationController,myselfNaigationController]
        
        let tabBarItemImages = ["first","second","third","fourth"]
        let tabBarItemTitles = ["大师","训练","俱乐部","我"]
        
        let tabBar = self.tabBar
        tabBar?.frame = CGRect(x: (tabBar?.frame.minX)!, y: (tabBar?.frame.minY)!, width: (tabBar?.frame.width)!, height: 63)
        var index : Int = 0
        for item in self.tabBar.items as! [RDVTabBarItem]{
            let selectedimage = UIImage(named: "\(tabBarItemImages[index])"+"_select")
            let unselectedimage = UIImage(named: "\(tabBarItemImages[index])"+"_unselect")
            
            item.setFinishedSelectedImage(selectedimage, withFinishedUnselectedImage: unselectedimage)
            item.title = tabBarItemTitles[index]
            index += 1
        }
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    /*
     // MARK: - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     // Get the new view controller using segue.destinationViewController.
     // Pass the selected object to the new view controller.
     }
     */
    
}
